// 引入vue 和 vuex
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		fontSize: 3.8,
		userInfo: {},
		hasLogin: false,
		avatarUrl: '',
		villageId: '',
		tabCurrentIndex: 0,
		village: '',
		id: ''
	},
	mutations: {
		setUserInfo(state, data) {
			state.userInfo = data
		},
		setLogin(state) {
			state.hasLogin = true
		},
		updateAvatar(state, data){
			state.avatarUrl = data
		},
		setCurrentIndex(state, index){
			state.tabCurrentIndex = index
		},
		setCurrentVillage(state,village){
			state.village = village.label
			state.id = village.id
		}
	},
	actions: {
		
	},
	getters: {
	}
})
export default store